#include<stdio.h>
#include<stdlib.h>

#define MAXNUM 10
#define ELEMTYPE float
typedef struct{
	ELEMTYPE stack[ MAXNUM ];
	int top;
}QStype;

void initiateQStack( QStype *s ){
	s->top = -1;
}

int pushQStack( QStype *s, ELEMTYPE c ){
	if( s->top >= MAXNUM - 1 )
		return 0;
	else{
		s->stack[ ++(s->top) ] = c;
		return 1;
	}
}

int popQStack( QStype *s, ELEMTYPE *p ){
	if( s->top == -1 )
		return 0;
	*p =  s->stack[ (s->top)-- ];
	return 1;
}

int isEmpty( QStype *s ){
	if( s->top == -1 )
		return 1;
	return 0;

}

int getTopElem( QStype *s, ELEMTYPE *p){
	if( isEmpty( s ) )
		return 0;
	*p = s->stack[ s->top ];
	return 1;
}
